package com.chcplayer.ui
{
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.events.Event;

/**
 * author yh
 */
public class ColorHueAdjuster extends Sprite
{
	/**
	 */
	private var m_obChooser:HsbColorChooser;
	/**
	 */
	[Embed(source="Assets/Icon/ui/HueValueAnchor.png")]
	private var m_cAnchor:Class;
	/**
	 */
	private var m_picLeftAnchor:Bitmap;
	private var m_picRightAnchor:Bitmap;
	/**
	 */
	public function ColorHueAdjuster()
	{
		super();
		this._init();
	}
//--------------------------------------------------------------------------------------------------
// private
//--------------------------------------------------------------------------------------------------
	private function _init():void
	{
		m_picLeftAnchor = new m_cAnchor();
		m_picRightAnchor = new m_cAnchor();
		m_picRightAnchor.scaleX = -1;
		/*
		*/
		m_picLeftAnchor.y = m_picRightAnchor.y = -(m_picLeftAnchor.height>>1);
		m_picLeftAnchor.x = -m_picLeftAnchor.width;
		/*
		*/
		this.addChild(m_picLeftAnchor);
		this.addChild(m_picRightAnchor);
	}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// events
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	private function change_chooser(e:Event):void
	{
		this.y = m_obChooser.getHue();
	}
//==================================================================================================
// public
//==================================================================================================
	public function setChooser(obC:HsbColorChooser):void
	{
		m_obChooser = obC;
		if ( obC != null )
		{
			m_picRightAnchor.x = m_picRightAnchor.width + obC.getHueStripWidth();
			obC.addEventListener(Event.CHANGE, change_chooser);
		}
	}
}
}